import React, { Component } from 'react'
import axios from 'axios';

export default class Proxy extends Component {
    render() {
        return (
            <div className="proxy-container">
                <button onClick={this.getStudent}>获取学员信息</button>
                <button onClick={this.getCar}>获取汽车信息</button>
                <button onClick={this.getHot}>获取知乎热榜</button>
                <button onClick={this.getMeituan}>获取美团数据</button>
                <button onClick={this.getMovie}>获取热映电影</button>
                <button onClick={this.getBilibili}>获取bilibili漫画</button>
            </div>
        )
    }

    getStudent = async () => {
        // let result = await axios('/api/v3/feed/topstory/hot-list-web?limit=50&desktop=true');
        let result = await axios('/students'); // 5000 端口的
        console.log(result);
    }

    getCar = async () => {
        let result = await axios('/cars');
        console.log(result);
    }

    getHot = async () => {
        let result = await axios('/zhihu/api/v3/feed/topstory/hot-list-web?limit=50&desktop=true');
        console.log(result);

        // https://www.zhihu.com/zhihu/api/v3/.....
    }

    getMeituan = async () => {
        let result = await axios('/meituan/api/data/meituan');
        console.log(result);
    }

    getMovie = async () => {
        //发送请求
        let result = await axios('/meituan/ptapi/getHotFilms?ci=1&limit=10');
        console.log(result);
    }

    getBilibili = async () => {
        let result = await axios.post(
            '/bilibili/twirp/comic.v1.Comic/HomeRecommend?device=pc&platform=web',
            {page_num: 1, seed: "0"}
        );

        console.log(result);
    }
}
